<?php

//require_once 'ForumMessage.php';
//require_once 'Repere.php';
//require_once 'Vote.php';
require_once 'BaseModel.php';

/**
 * @access public
 * @author Joana
 * @package Mapping_Dead.Mod�le
 */
class User extends BaseModel {

    /**
     * @AttributeType int
     */
    protected $idUser;

    /**
     * @AttributeType string
     */
    protected $login;

    /**
     * @AttributeType string
     */
    protected $password;

    /**
     * @AttributeType 
     */
    protected $statut;

    /**
     * @AttributeType String
     */
    protected $email;

    /**
     * @AttributeType Date
     */
    protected $dateInscription;

    /**
     * @AttributeType Image
     */
    protected $avatar;

    /**
     * @AttributeType int
     */
    protected $fiabilite;

    /**
     * @AttributeType boolean
     */
    protected $actif;

    /**
     * @AttributeType String
     */
    protected $signature;
    protected $timeline;

    /**
     * @access public
     */
    public function __construct($id = null) {
        parent::__construct($id);
    }

    /**
     * @access public
     * @param String login
     * @param String mdp
     * @param String mail
     * @ParamType login String
     * @ParamType mdp String
     * @ParamType mail String
     */
    public function inscription($login, $mdp, $mail) {
        $args = array('login'=>$login,'password'=>$mdp,'email'=>$mail,'statut'=>3,'actif'=>1);
        return $this->addElement($args);
    }

    /**
     * @access public
     * @param String login
     * @param String mail
     * @return boolean
     * @ParamType login String
     * @ParamType mail String
     * @ReturnType boolean
     */
    public function verifExisteLogin($login) {
        $args = array('login'=>$login);
        return $this->getElement($args);
    }

    public function verifExisteMail($mail) {
        $args = array('email'=>$mail);
        return $this->getElement($args);
    }

    public function afficherListeUser() {
        return $this->findAll();
    }


    /**
     * @access public
     * @param String login
     * @param String mdp
     * @return void
     * @ParamType login String
     * @ParamType mdp String
     * @ReturnType void
     */
    public function authentification($login, $mdp) {
        $args = array('login'=>$login,'password'=>$mdp);
        return $this->getElement($args);
    }

    public function changeUsername($idUser, $newUsername) {
        $args = array('login'=>$newUsername);
        return $this->updateElement($args, $idUser);
    }

    public function changeMail($username, $newMail) {
        $args = array('email'=>$newMail);
        return $this->updateElementByLogin($args, $username);
    }

    public function changePassword($username, $newMdp) {
        $args = array('password'=>$newMdp);
        return $this->updateElementByLogin($args, $username);
    }

    public function changeStatut($idUser,$newStatut) {
        $args = array('statut'=>$newStatut);
        $this->updateElement($args, $idUser);
    }

    public function changeActif($idUser,$newActif) {
        $args = array('actif'=>$newActif);
        $this->updateElement($args, $idUser);
    }

    public function getInfo($id) {
        return $this->getById($id);
    }

    /**
     * @access public
     * @return boolean
     * @ReturnType boolean
     */
    public function verifFiabilite() {
        // Not yet implemented
    }

    /**
     * @access public
     * @return int
     * @ReturnType int
     */
    public function getIdUser() {
        return $this->idUser;
    }

    /**
     * @access public
     * @param int idUser
     * @return void
     * @ParamType idUser int
     * @ReturnType void
     */
    public function setIdUser($idUser) {
        $this->idUser = $idUser;
    }

    /**
     * @access public
     * @return string
     * @ReturnType string
     */
    public function getLogin() {
        return $this->login;
    }

    /**
     * @access public
     * @param string login
     * @return void
     * @ParamType login string
     * @ReturnType void
     */
    public function setLogin($login) {
        $this->login = $login;
    }

    /**
     * @access public
     * @return string
     * @ReturnType string
     */
    public function getPassword() {
        return $this->password;
    }

    /**
     * @access public
     * @param string password
     * @return void
     * @ParamType password string
     * @ReturnType void
     */
    public function setPassword($password) {
        $this->password = $password;
    }

    /**
     * @access public
     * @return String
     * @ReturnType String
     */
    public function getStatut() {
        return $this->statut;
    }

    /**
     * @access public
     * @param String statut
     * @return void
     * @ParamType statut String
     * @ReturnType void
     */
    public function setStatut($statut) {
        // Not yet implemented
    }

    /**
     * @access public
     * @return String
     * @ReturnType String
     */
    public function getMail() {
        return $this->email;
    }

    /**
     * @access public
     * @param String mail
     * @return void
     * @ParamType mail String
     * @ReturnType void
     */
    public function setMail($mail) {
        $this->mail = $mail;
    }

    /**
     * @access public
     * @return Date
     * @ReturnType Date
     */
    public function getDateInscription() {
        // Not yet implemented
    }

    /**
     * @access public
     * @param Date dateInscription
     * @return void
     * @ParamType dateInscription Date
     * @ReturnType void
     */
    public function setDateInscription(Date_3 $dateInscription) {
        // Not yet implemented
    }

    /**
     * @access public
     * @return Image
     * @ReturnType Image
     */
    public function getAvatar() {
        return $this->avatar;
    }

    /**
     * @access public
     * @param Image avatar
     * @return void
     * @ParamType avatar Image
     * @ReturnType void
     */
    public function setAvatar(Image $avatar) {
        $this->avatar = $avatar;
    }

    /**
     * @access public
     * @return int
     * @ReturnType int
     */
    public function getFiabilite() {
        return $this->fiabilite;
    }

    /**
     * @access public
     * @param int fiabilite
     * @return void
     * @ParamType fiabilite int
     * @ReturnType void
     */
    public function setFiabilite($fiabilite) {
        $this->fiabilite = $fiabilite;
    }

    /**
     * @access public
     * @return boolean
     * @ReturnType boolean
     */
    public function getActif() {
        return $this->actif;
    }

    public function getTimeline() {
        return $this->timeline;
    }
    /**
     * @access public
     * @param boolean actif
     * @return void
     * @ParamType actif boolean
     * @ReturnType void
     */
    public function setActif($actif) {
        $this->actif = $actif;
    }

    /**
     * @access public
     * @param int idUser
     * @ParamType idUser int
     */
    public function bannirUser($idUser) {
        // Not yet implemented
    }

    /**
     * @access public
     * @param int isUser
     * @param int statut
     * @ParamType isUser int
     * @ParamType statut int
     */
    public function modifierStatutUser($isUser, $statut) {
        // Not yet implemented
    }

}

?>